#pragma once

#include <QObject>
#include <vector>
#include <memory>
#include <QString>
#include "quote_defines.h"


namespace QuoteEngine {

class QUOTE_EXPORT Engine : public QObject {
    Q_OBJECT
    
public:
    explicit Engine(QObject* parent = nullptr);
    ~Engine();
    
    // 禁用拷贝
    Engine(const Engine&) = delete;
    Engine& operator=(const Engine&) = delete;
    
    // 核心功能接口
    bool init(const QuoteConfig& config);
    void start();
    void stop();
    
    // 订阅接口
    bool subscribe(const std::vector<QString>& symbols);
    bool unsubscribe(const std::vector<QString>& symbols);
    
    // 状态查询
    ConnectionStatus connectionStatus() const { return status; }
    
    // 获取已订阅的合约列表
    std::vector<QString> getSubscribedSymbols() const;
    
signals:
    void onTick(const CThostFtdcDepthMarketDataField& tick);
    void onStatusChanged(ConnectionStatus status);
    void onError(int errorID, const QString& errorMsg);
    
private:
    class EnginePrivate;
    std::unique_ptr<EnginePrivate> d_ptr;
    ConnectionStatus status{ConnectionStatus::Disconnected};
};

} // namespace QuoteEngine 